import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:jinke/utils/component/list/table_view.dart';
import 'package:jinke/utils/util.dart';

import 'index.dart';
import 'widgets/widgets.dart';

class ProListPage extends StatelessWidget {
  ProListPage({Key? key}) : super(key: key);
  final controller = Get.put(ProListController());
  final state = Get.find<ProListController>().state;
  // 主视图
  Widget _buildView() {
    return TableView(
      data: state.list ?? [],
      header: const ProListHeader(),
    );
  }

  @override
  Widget build(BuildContext context) {
    return GetBuilder<ProListController>(
      builder: (_) {
        return Scaffold(
          // backgroundColor: Colors,
          body: _buildView(),
          floatingActionButtonLocation:
              FloatingActionButtonLocation.centerDocked,
          floatingActionButton: Container(
            margin: EdgeInsets.only(bottom: 80.r),
            alignment: Alignment.bottomRight,
            child: InkWell(
              onTap: () {
                Get.toNamed(RouterPath.pro_open);
              },
              child: Container(
                width: 93.r,
                height: 40.r,
                alignment: Alignment.center,
                decoration: BoxDecoration(
                  gradient: const LinearGradient(
                    colors: [
                      Color(0xff00A9FE),
                      Color(0xff0173FE),
                    ],
                    begin: Alignment.centerLeft,
                    end: Alignment.centerRight,
                  ),
                  borderRadius: BorderRadius.horizontal(
                    left: Radius.circular(20.r),
                  ),
                ),
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: [
                    Icon(
                      Icons.add,
                      color: Colors.white,
                      size: 20.r,
                    ),
                    Text(
                      '建项目',
                      style: TextStyle(color: Colors.white, fontSize: 15.sp),
                    )
                  ],
                ),
              ),
            ),
          ),
        );
      },
    );
  }
}
